package com.ruoyi.system.controller;

import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.system.domain.SysBusiness;
import com.ruoyi.system.domain.SysBusinessFinanceRecord;
import com.ruoyi.system.service.ISysBusinessFinanceRecordService;
import com.ruoyi.system.service.ISysBusinessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 商家余额记录Controller
 * 
 * @author ruoyi
 * @date 2024-04-14
 */
@RestController
@RequestMapping("/bus/record")
public class BusBusinessFinanceRecordController extends BaseController
{
    @Autowired
    private ISysBusinessFinanceRecordService sysBusinessFinanceRecordService;
    @Autowired
    private ISysBusinessService sysBusinessService;
    /**
     * 查询商家余额记录列表
     */
    @GetMapping("/list")
    public TableDataInfo list(SysBusinessFinanceRecord sysBusinessFinanceRecord) throws Exception {

        SysBusiness bu = sysBusinessService.getUserInfo();
        if(bu==null){
            throw new Exception("用户未登陆");
        }
        startPage();
        List<SysBusinessFinanceRecord> list = sysBusinessFinanceRecordService.selectSysBusinessFinanceRecordList(sysBusinessFinanceRecord);
        return getDataTable(list);
    }



    /**
     * 获取商家余额记录详细信息
     */
    @GetMapping(value = "/info")
    public AjaxResult getInfo(@RequestParam(name = "id",required = true) String  id)
    {
        return success(sysBusinessFinanceRecordService.selectSysBusinessFinanceRecordById(id));
    }

}
